import { http } from "@/utils/http";
import type { HttpResult } from "@/utils/http/types";

export function queryConfigTable(params) {
  return http.request<HttpResult>("get", "/admin/config/get/table", {
    params: params
  });
}

export function queryConfigList(params) {
  return http.request<HttpResult>("get", "/admin/config/get/list", {
    params: params
  });
}

export function queryConfigTreeList(params) {
  return http.request<HttpResult>("get", "/admin/config/get/treelist", {
    params: params
  });
}

export function addConfig(params) {
  return http.request<HttpResult>("post", "/admin/config/insert", {
    data: params
  });
}

export function addOrUpdateBatch(params) {
  return http.request<HttpResult>("post", "/admin/config/update/merge", {
    data: params
  });
}

export function updateConfig(params) {
  return http.request<HttpResult>("post", "/admin/config/update", {
    data: params
  });
}

export function deleteConfig(ids) {
  return http.request<HttpResult>("post", `/admin/config/delete/${ids}`);
}

export function queryValid(data) {
  return http.request<HttpResult>("get", "/admin/config/get/exists", {
    params: data
  });
}
